﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_LayoutForm.cshtml";
}
<script>  
$(function () {
        initSearchControl({
            id: 'unitSearch',
            name: 'unitSeq',
            value :'@Model.unitSeq',
            displayText : '@ViewBag.UnitName',
            height:280,
            dataSource: @Html.Raw(this.ViewBag.UnitList),
            colModel: [{
                        label: 'ID',
                        name: 'ID',
                        width: 30,
                        key: true
                    }, {
                        label: '单位编码',
                        width: 50,
                        name: 'unitSeq'
                    }, {
                        label: '单位名称',
                        name: 'unitName'
                    }]
        });
        initSearchControl({
            id: 'busiSearch',
            name: 'busiSeq',
            value :'@Model.busiSeq',
            displayText : '@ViewBag.BusiName',
            height:280,
            filter : function(ds,txt){
                var newData = new Array();
                ds.forEach(function(obj)
                {
                    if(obj["unitSeq"]==$('form [name=unitSeq]').val()&&
                    (obj["busiSeq"].indexOf(txt)>=0||obj["busiCode"].indexOf(txt)>=0||obj["busiName"].indexOf(txt)>=0))
                    newData.push(obj);
                });
                return newData;
            },
            dataSource: @Html.Raw(this.ViewBag.BusiList),
            colModel: [{
                        label: '业务流水号',
                        name: 'busiSeq',
                        width: 50,
                        key: true
                    }, {
                        label: '业务编码',
                        width: 50,
                        name: 'busiCode'
                    }, {
                        label: '业务名称',
                        name: 'busiName'
                    }]
        });
    });
    function submitForm(callback) {
        $.submitForm({
            url: "SubmitBusiForm",
            data: $('form').serializeForm(),
            callback: callback
        });
    }
</script>
<div class="page-content">
    <div class="row">
        <div class="col-xs-12">
            <form class="form-horizontal" style="margin-top: 30px">
            <input  type="hidden" name= "ID" value="@Model.ID" />
            <input  type="hidden" name= "AreaNo" value="@Model.AreaNo" />
            <div class="form-group">
                <label class="col-sm-3 col-xs-3">
                    ID
                </label>
                <div class="col-sm-9 col-xs-9">
                    <input id="txtId" readonly type="text" class="col-xs-10 col-sm-10" />
                    <script>
                        var id = $("form input[name='ID']").val();
                        if (id == -1)
                            $("#txtId").val("新增");
                        else
                            $("#txtId").val(id);
                    </script>
                </div>
            </div>
            <input  type="hidden" name= "WindowID" value="@Model.WindowID" />
            <div class="form-group">
                <label class="col-sm-3 col-xs-3">
                    所属窗口
                </label>
                <div class="col-sm-9 col-xs-9">
                    <input type="text" readonly value="@ViewBag.WindowName" autocomplete="off" class="col-xs-10 col-sm-10" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 col-xs-3">
                    对应单位
                </label>
                <div class="col-sm-9 col-xs-9">
                    <input type="text" id="unitSearch" displaymember='unitName' valuemember='unitSeq'
                        autocomplete="off" class="col-xs-10 col-sm-10" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 col-xs-3">
                    对应业务
                </label>
                <div class="col-sm-9 col-xs-9">
                    <input type="text" id="busiSearch" displaymember='busiName' valuemember='busiSeq'
                        autocomplete="off" class="col-xs-10 col-sm-10" />
                </div>
            </div>
            </form>
        </div>
    </div>
</div>
